package com.ys.controller.web.sys;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.ys.entity.business.StaticConfig;

import lombok.AllArgsConstructor;
import lombok.Data;

@Controller
@RequestMapping("/web/inter/staticConfig")
public class WebSysStaticConfigController {
	
	
	/**
	 * 官网LOGO信息资讯
	 */
	@GetMapping("/toEditLogoNews")
	public String toEditLogoNews(Model model){
		
		StaticConfig staticConfig = new StaticConfig().setCode("news-info").queryFirst();
		
		// LOGO地址
		String urlLogo = JSON.parseObject(staticConfig.getInfo()).getString("urlLogo");
		
		ToConfigLogoNewsDto dto = new ToConfigLogoNewsDto(urlLogo);
		model.addAttribute("dto", dto);
		
		return "sys/staticConfig/toEditLogoNews";
	}
	
	@Data
	@AllArgsConstructor
	public static class ToConfigLogoNewsDto {
		private String urlLogo; // logo地址

		@Data
		@AllArgsConstructor
		public static class MenuDto {
			private String name; // 菜单名称
			private List<SubDto> subArr; // 二级菜单数组

			@Data
			@AllArgsConstructor
			public static class SubDto {
				private String linkTo; // 跳转链接
				private String name; // 菜单名称
			}
		}
	}
}
